package com.qinggeng.framework.config.mq.impl;

import com.alibaba.fastjson.JSONObject;
import com.qinggeng.framework.config.mq.dto.MessageBeatDTO;
import com.qinggeng.framework.config.mq.handle.MessageHandle;
import com.qinggeng.project.system.service.UserBeatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author 吴鹏飞
 * @date 2020/11/20
 * 捶一捶失败处理
 */
@Component
public class BeatABeatFailHandleImpl implements MessageHandle {
    @Autowired
    private UserBeatService userBeatService;

    @Override
    public void handle(String msg) {
        MessageBeatDTO messageBeatDto = JSONObject.parseObject(msg, MessageBeatDTO.class);
        userBeatService.updateUserBeatForFail(messageBeatDto);
    }
}
